using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using emp.ProcessFlow;
using emp.BLL;
using emp.Model;

public partial class crm_cell_condition_ConditionPreviewView : System.Web.UI.Page
{

    string filename = "";
    string ccp_id = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.Params["filename"] != null && Request.Params["filename"].Equals("") == false)
        {
            filename = Request.Params["filename"];
        }
        hidden_filename.Value = filename;
        if (Request.Params["ccp_id"] != null && Request.Params["ccp_id"].Equals("") == false)
        {
            ccp_id = Request.Params["ccp_id"];
        }
        hidden_ccpid.Value = ccp_id;
        if (ccp_id == "")
        {
            string filepath = Server.MapPath("/pub/crm/exportfiles/");
            Response.Clear();

            Response.ContentType = "application/vnd.ms-excel";

            Response.AddHeader("Content-Disposition", "attachment;FileName=" + HttpUtility.UrlEncode(filename, System.Text.Encoding.UTF8));

            Response.WriteFile(filepath + filename);

            Response.End();
        }
        else
        {
            string filepath = Server.MapPath("/pub/crm/exportfiles/");
            Response.Clear();

            Response.ContentType = "text/HTML";

            Response.AddHeader("Content-Disposition", "attachment;FileName=" + HttpUtility.UrlEncode(filename, System.Text.Encoding.UTF8));

            Response.WriteFile(filepath + filename);

            Response.End();
        }
    }
}
